﻿var wysiwyg_valid_tags = "a[href|rel|rev|target|title|type]," +
        "b[],"+
        "blink[],"+
        "blockquote[align|cite|clear|height|type|width],"+
        "br[clear],"+
        "caption[align|height|valign|width],"+
        "center[align|height|width],"+
        "col[align|bgcolor|char|charoff|span|valign|width],"+
        "colgroup[align|bgcolor|char|charoff|span|valign|width],"+
        "comment[],"+
        "em[],"+
        "font[color|face|font-weight|point-size|size],"+
        "h1[align|clear|height|width],"+
        "h2[align|clear|height|width],"+
        "h3[align|clear|height|width],"+
        "h4[align|clear|height|width],"+
        "h5[align|clear|height|width],"+
        "h6[align|clear|height|width],"+
        "hr[align|clear|color|noshade|size|width|style],"+
        "img[align|alt|border|height|hspace|src|vspace|width|style],"+
        "li[align|clear|height|type|value|width|style|class],"+
        "marquee[behavior|bgcolor|direction|height|hspace|loop|scrollamount|scrolldelay|vspace|width],"+
        "ol[align|clear|height|start|type|width],"+
        "p[align|clear|height|width|style|class],"+
        "pre[clear|width|wrap],"+
        "s[],"+
        "small[],"+
        "span[class|align|style],"+
        "strike[],"+
        "strong[style|class],"+
        "sub[],"+
        "sup[],"+
        "table[style|align|background|bgcolor|border|bordercolor|bordercolordark|bordercolorlight|"+
               "bottompadding|cellpadding|cellspacing|clear|cols|height|hspace|leftpadding|"+
               "rightpadding|rules|summary|toppadding|vspace|width|class],"+
        "tbody[align|bgcolor|char|charoff|valign],"+
        "td[style|abbr|align|axis|background|bgcolor|bordercolor|"+
           "bordercolordark|bordercolorlight|char|charoff|headers|"+
           "height|nowrap|rowspan|scope|valign|width|colspan|class],"+
        "tfoot[align|bgcolor|char|charoff|valign],"+
        "th[abbr|align|axis|background|bgcolor|bordercolor|"+
           "bordercolordark|bordercolorlight|char|charoff|headers|"+
           "height|nowrap|rowspan|scope|valign|width|colspan|class],"+
        "thead[align|bgcolor|char|charoff|valign],"+
        "tr[align|background|bgcolor|bordercolor|"+
           "bordercolordark|bordercolorlight|char|charoff|"+
           "height|nowrap|valign],"+
        "tt[],"+
        "u[],"+
        "ul[align|clear|height|start|type|width|style|class],"+
		"object[width|height|classid|codebase],param[name|value],embed[src|type|allowscriptaccess|allowfullscreen|width|height],"+
		"div[align|style|id|class]";

/*var wysiwyg_simple = {

	// General options
	mode : "specific_textareas",
	editor_selector : "input_textarea",
	theme : "advanced",
	width : "98%",
	height : "400px",
	skin : "o2k7",
	plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

	// Theme options
	theme_advanced_buttons1 : "newdocument,code,preview,|,print,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "link,unlink,anchor,image,|,forecolor,backcolor,|,undo,redo,|,fullscreen",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	//language : site_language == "vn" ? "vi" : site_language,
	forced_root_block : false,
	force_br_newlines : true,
	force_p_newlines : false,
	// Example content CSS (should be your site CSS)
	//content_css : site_root_domain + "/templates/css/admin_style.css",

	// Drop lists for link/image/media/template dialogs
	//template_external_list_url : "lists/template_list.js",
	//external_link_list_url : "lists/link_list.js",
	//external_image_list_url : "lists/image_list.js",
	//media_external_list_url : "lists/media_list.js",
	entities : "38,amp,60,lt,62,gt", // Very important for Search, lyhuuloi
	valid_elements : "p[*]/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]",
	extended_valid_elements : wysiwyg_valid_tags,

	// Style formats

	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}
};

var wysiwyg_advance = {
	mode : "specific_textareas",
    editor_selector : "input_textarea",
	theme : "advanced",
	width : "98%",
	height : "500px",
	skin : "o2k7",
	//skin_variant : "silver",
	theme_advanced_buttons1 : "newdocument,code,preview,|,print,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,|,link,unlink,anchor,image,|,forecolor,backcolor,|,fullscreen",
	theme_advanced_buttons2 : "pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,sub,sup,|,charmap,emotions,iespell,media,|,ltr,rtl",
	theme_advanced_buttons3 : "tablecontrols,|,advhr,removeformat,visualaid",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	theme_advanced_resizing : true,
	browsers : "msie,gecko,opera,safari",
	language : site_language == "vn" ? "vi" : site_language,
	//content_css : "style.css",
	dialog_type : "modal",
	theme_advanced_resize_horizontal : false,
	convert_urls : false,
	relative_urls : false,
	remove_script_host : false,
	force_p_newlines : false,
	force_br_newlines : true,
	convert_newlines_to_brs : false,
	remove_linebreaks : false,
	fix_list_elements : true,
	//gecko_spellcheck : true,
	entities : "38,amp,60,lt,62,gt", // Very important for Search, lyhuuloi
	valid_elements : "p[*]/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]",
	extended_valid_elements : wysiwyg_valid_tags,
	button_tile_map : true,
	media_strict: false,
	plugins : "youtubbe,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",
};

var wysiwyg_quick = {
	mode : "specific_textareas",
    editor_selector : "input_textarea",
	theme : "advanced",
	width : "98%",
	height : "200px",
	skin : "o2k7",
	//skin_variant : "silver",
	theme_advanced_buttons1 : "newdocument,code,preview,|,print,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	theme_advanced_resizing : true,
	browsers : "msie,gecko,opera,safari",
	language : site_language == "vn" ? "vi" : site_language,
	//content_css : "style.css",
	dialog_type : "modal",
	theme_advanced_resize_horizontal : false,
	convert_urls : false,
	relative_urls : false,
	remove_script_host : false,
	force_p_newlines : false,
	force_br_newlines : true,
	convert_newlines_to_brs : false,
	remove_linebreaks : false,
	fix_list_elements : true,
	//gecko_spellcheck : true,
	entities : "38,amp,60,lt,62,gt", // Very important for Search, lyhuuloi
	valid_elements : "p[*]/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]",
	extended_valid_elements : wysiwyg_valid_tags,
	button_tile_map : true,
	media_strict: false,
	plugins : "youtubbe,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",
};

*/

var wysiwyg_height = new Array();
wysiwyg_height[0] = "400px";
wysiwyg_height[1] = "500px";
wysiwyg_height[2] = "250px";

function wysiwyg_init( wysiwyg_mode )
{
	//if ( wysiwyg_mode == 1 )
	//{
	//	tinyMCE.init(wysiwyg_advance);
	//}
	//else if ( wysiwyg_mode == 2 )
	//{
	//	tinyMCE.init(wysiwyg_quick);
	//}
	//else
	//{

		tinyMCE.init({
			// General options
			mode : "specific_textareas",
			editor_selector : "input_textarea",
			theme : "advanced",
			width : "755px",
			height : (wysiwyg_mode ? wysiwyg_height[wysiwyg_mode] : wysiwyg_height[0]),
			skin : "o2k7",
			plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,tinyautosave",
	
			// Theme options
			theme_advanced_buttons1 : "newdocument,code,preview,|,print,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "link,unlink,anchor,image,|,forecolor,backcolor,|,undo,redo,|,fullscreen",
			theme_advanced_buttons3 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,
			
			// Auto save
			theme_advanced_buttons1_add_before: "tinyautosave",
			tinyautosave_oninit: "configAutoSave",
			
			forced_root_block : false,
			force_br_newlines : true,
			force_p_newlines : false,
			convert_urls : false,
			// Example content CSS (should be your site CSS)
			//content_css : "css/content.css",
	
			entities : "38,amp,60,lt,62,gt", // Very important for Search, lyhuuloi
			valid_elements : "p[*]/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]",
			extended_valid_elements : wysiwyg_valid_tags,
	
			// Drop lists for link/image/media/template dialogs
			//template_external_list_url : "lists/template_list.js",
			//external_link_list_url : "lists/link_list.js",
			//external_image_list_url : "lists/image_list.js",
			//media_external_list_url : "lists/media_list.js",
	
	
			// Replace values for the template plugin
			template_replace_values : {
				username : "Some User",
				staffid : "991234"
			}
		});
	//}
}

function configAutoSave()
{
	//if (this.id == "ed1")

	this.onPostSave = function () {  // Assigned with function
	
	};
}